<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/10
 * Time: 17:26
 */

namespace App\Services;

use App\Models\TaskLog;

class TaskLogService extends BaseService
{
    protected $modelClass = TaskLog::class;

    /**
     * 添加
     * @param $postData
     * @return bool|string
     * @throws \Exception
     */
    public function add($postData)
    {
        return $this->saveData($postData);
    }

    /**
     * @desc 列表
     * @param array $search
     * @return array
     */
    public function getList($search=[])
    {
        $res = $this->model->where('is_enable', 1);
        if (!empty($search['task_id'])) {
            $res = $res->where('task_id', $search['task_id']);
        }

        return $res->orderBy('id', 'desc')->get();
    }

}